{% extends '@WebProfiler/Profiler/layout.html.twig' %}

{% block toolbar %}
    {% set icon %}
        {{ source('@VichUploader/Collector/icon.svg') }}
        <span class="sf-toolbar-value">{{ collector.mappingsCount }}</span>
    {% endset %}

    {% set text %}
        <div class="sf-toolbar-info-piece">
            <b>Mappings</b>
            <span class="sf-toolbar-status sf-toolbar-status-grey">{{ collector.mappingsCount }}</span>
        </div>
    {% endset %}

    {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', {link: true}) }}
{% endblock %}

{% block menu %}
    {# This left-hand menu appears when using the full-screen profiler. #}
    <span class="label">
        <span class="icon">
            {{ source('@VichUploader/Collector/icon.svg') }}
        </span>
        <strong>VichUploader</strong>
    </span>
{% endblock %}

{% block panel %}
    <h2>VichUploaderBundle Mappings</h2>
    <table>
        <thead>
            <tr>
                <th scope="col">Field</th>
                <th scope="col">Mapping</th>
                <th scope="col">Filename property</th>
                <th scope="col">Size property</th>
                <th scope="col">Mime Type property</th>
                <th scope="col">Original Name property</th>
                <th scope="col">Dimensions property</th>
            </tr>
        </thead>
        <tbody>
            {% for class, data in collector.mappings %}
                <tr>
                    <th scope="row" colspan="7">{{ class }}</th>
                </tr>
                {% for mdata in data %}
                    <tr>
                        <td>{{ mdata.propertyName }}</td>
                        <td>{{ mdata.mapping }}</td>
                        <td>{{ mdata.fileNameProperty|default('<span class="text-danger">Not Set</span>')|raw }}</td>
                        <td>{{ mdata.size|default('<span class="text-danger">Not Set</span>')|raw }}</td>
                        <td>{{ mdata.mimeType|default('<span class="text-danger">Not Set</span>')|raw }}</td>
                        <td>{{ mdata.originalName|default('<span class="text-danger">Not Set</span>')|raw }}</td>
                        <td>{{ mdata.dimensions|default('<span class="text-danger">Not Set</span>')|raw }}</td>
                    </tr>
                {% endfor %}
            {% endfor %}
        </tbody>
    </table>
{% endblock %}
